package hit.dao;

import java.sql.Connection;

import hit.core.HomeInventoryTracker;

/**
 * The main DAO for the HIT. This interface should be extended for classes that implement
 * a particular form of persistence.
 */
public interface DataAccessObject {
	
	
	/**
	 * Load all the data in the HIT from the last use.
	 * @return the loaded HomeInventoryTracker
	 */
	public HomeInventoryTracker Load();
	
	/**
	 * Save all the data in the HIT
	 * @param hit the HomeInventoryTracker to save
	 */
	public void Close(HomeInventoryTracker hit);
	/**
	 *
	 * @return the DAO that handles all StorageUnit operations
	 */
	public DAOBase GetStorageUnitDAO();
	/**
	 *
	 * @return the DAO that handles all ProductGroup operations
	 */
	public DAOBase GetProductGroupDAO();
	/**
	 *
	 * @return the DAO that handles all Product Operations
	 */
	public DAOBase GetProductDAO();
	/**
	 *
	 * @return the DAO that handles all Item operations
	 */
	public DAOBase GetItemDAO();
	/**
	 *
	 * @return the DAO that handles all HIT Settings
	 */
	public SettingsDAO GetSettingsDAO();
	
	
	public void CloseConnection();
	/**
	 * Starts a database transaction with the open {@link Connection}.
	 */
	public void StartTransaction();
	
	/**
	 * Ends the open transaction.
	 * @param commit Commit changes if True. Do nothing otherwise.
	 */
	public void EndTransaction(boolean commit);
}
